//
//  EditContactTableView.m
//  DaMaoMall
//
//  Created by DaMaoPC on 16/8/8.
//  Copyright © 2016年 daMao-wally. All rights reserved.
//

#import "EditContactTableView.h"

@interface EditContactTableView ()

@property (nonatomic, strong) NSArray *titleArray;
@property (nonatomic, copy) NSString *contantStr;
@property (nonatomic, copy) NSString *phoneStr;
@end

@implementation EditContactTableView


- (NSArray *)titleArray {
    if(_titleArray == nil) {
        _titleArray = @[@"联系人:",@"联系电话:",@"地址:"];
    }
    return _titleArray;
}

-(instancetype)init {
    if (self = [super init]) {
        self.frame = CGRectMake(0, UI_NAVIGATION_BAR_HEIGHT + UI_STATUS_BAR_HEIGHT, GetScreenWidth, GetScreenHeight);
        self.delegate = self;
        self.dataSource = self;
    }
    return self;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.titleArray.count + 1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    EditContantCell *editCell = [tableView dequeueReusableCellWithIdentifier:@"EditContantCell"];
    if(editCell == nil) {
        editCell = [[[NSBundle mainBundle]loadNibNamed:@"EditContantCell" owner:self options:nil] lastObject];
    }
    
    [editCell displayValue:self.titleArray index:indexPath.row];
      return editCell;
}
- (void)editContantTable:(EditContantTableBlock)aBlock {
    self.editBlock = aBlock;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}
@end
